<template>
	<view>
		<uni-forms ref="form" :rules="{}">
			<uni-forms-item label="" name="title" style="margin: 20rpx ;">
				<uni-easyinput v-model="data.title" placeholder="请输入标题" />
			</uni-forms-item>
			<uni-forms-item label="" name="content" style="margin: 20rpx ;top: 20rpx;">
				<uni-easyinput v-model="data.content" type="textarea" placeholder="请输入内容" />
			</uni-forms-item>
			<uni-forms-item label="" name="">
				<button @click="Comment" type="primary" style="width: 94%; top: 20rpx;">发表</button>
			</uni-forms-item>
		</uni-forms>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: {
							"content": "",
							"id": "",
							"name": "",
							"title": "",
							date: null
						}
					}
				},
				onLoad(e) {
					this.data.name = e.name
					console.log(this.data.name);
		},
		methods: {
			Comment() {
				uni.request({
					url: 'http://localhost:8090/freshmenapp/message/addone',
					method: 'POST',
					data: this.data,
					success: res => {
						console.log(res.data);
						uni.showToast({
							title: "发表成功",
							icon: 'success'
						})
						uni.getStorageInfoSync()
						
					},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>

</style>
